package com.paypal.android.MEP.a;

import android.content.Context;
import android.text.Editable;
import android.text.TextWatcher;
import android.text.method.PasswordTransformationMethod;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams;
import android.widget.TextView;
import com.paypal.android.MEP.PayPalActivity;
import com.paypal.android.MEP.p;
import com.paypal.android.a.c;
import com.paypal.android.a.g;
import com.paypal.android.a.q;
import com.paypal.android.b.i;
import com.paypal.android.b.n;
import java.util.Hashtable;

public final class k extends n
  implements TextWatcher, View.OnClickListener, com.paypal.android.MEP.r, i
{
  public static String a = null;
  private static com.paypal.android.b.f l = null;
  private m b;
  private String c;
  private LinearLayout d;
  private RelativeLayout e;
  private com.paypal.android.MEP.b.e f;
  private EditText g;
  private EditText h;
  private EditText i;
  private Button j;
  private Button k;
  private TextView m;
  private Hashtable n;
  private com.paypal.android.b.k o;
  private LinearLayout p;
  private Context q;

  public k(Context paramContext)
  {
    super(paramContext);
  }

  private void a(String paramString, boolean paramBoolean)
  {
    LinearLayout localLinearLayout1 = com.paypal.android.a.f.a(this.q, -1, -2);
    RelativeLayout.LayoutParams localLayoutParams = new RelativeLayout.LayoutParams(localLinearLayout1.getLayoutParams());
    localLayoutParams.addRule(13);
    localLinearLayout1.setLayoutParams(localLayoutParams);
    localLinearLayout1.setOrientation(1);
    localLinearLayout1.setGravity(1);
    if (l == null)
      l = new com.paypal.android.b.f(this.q);
    while (true)
    {
      this.m = q.a(com.paypal.android.a.r.b, this.q);
      this.m.setGravity(1);
      this.m.setTextColor(-13408615);
      this.m.setText(paramString);
      if (paramBoolean)
      {
        LinearLayout localLinearLayout2 = com.paypal.android.a.f.a(this.q, -2, -2);
        localLinearLayout2.setOrientation(1);
        localLinearLayout2.setPadding(5, 10, 5, 10);
        com.paypal.android.b.k localk = new com.paypal.android.b.k(this.q, com.paypal.android.b.m.c);
        localk.a(com.paypal.android.a.j.a("ANDROID_pin_success"));
        localk.setPadding(5, 5, 5, 5);
        localLinearLayout2.addView(localk);
        localLinearLayout1.addView(localLinearLayout2);
      }
      localLinearLayout1.addView(l);
      localLinearLayout1.addView(this.m);
      this.e.removeAllViews();
      this.e.addView(localLinearLayout1);
      return;
      ((LinearLayout)l.getParent()).removeAllViews();
    }
  }

  private boolean c()
  {
    if (this.g.getText().toString().length() < 9)
      return false;
    return com.paypal.android.a.j.e(this.g.getText().toString());
  }

  private boolean f()
  {
    String str1 = this.h.getText().toString();
    String str2 = this.i.getText().toString();
    if ((str1.length() < 4) || (str1.length() > 8) || (str2.length() < 4) || (str2.length() > 8) || (!str1.equals(str2)))
      return false;
    return com.paypal.android.a.j.f(str1);
  }

  private void g()
  {
    try
    {
      ((InputMethodManager)PayPalActivity.a().getSystemService("input_method")).hideSoftInputFromWindow(this.g.getWindowToken(), 0);
      try
      {
        label23: ((InputMethodManager)PayPalActivity.a().getSystemService("input_method")).hideSoftInputFromWindow(this.h.getWindowToken(), 0);
        try
        {
          label46: ((InputMethodManager)PayPalActivity.a().getSystemService("input_method")).hideSoftInputFromWindow(this.i.getWindowToken(), 0);
          return;
        }
        catch (Exception localException3)
        {
        }
      }
      catch (Exception localException2)
      {
        break label46;
      }
    }
    catch (Exception localException1)
    {
      break label23;
    }
  }

  public final void a()
  {
    c.f().a("NewPhone", this.n.get("mobileNumber"));
    c.f().a("NewPin", this.n.get("newPIN"));
    c.f().a("delegate", this);
    c.f().a(11);
  }

  public final void a(int paramInt, Object paramObject)
  {
    this.b = m.c;
    h.b();
  }

  public final void a(Context paramContext)
  {
    super.a(paramContext);
    this.q = paramContext;
    this.b = m.a;
    LinearLayout localLinearLayout1 = com.paypal.android.a.f.a(paramContext, -1, -2);
    localLinearLayout1.setOrientation(1);
    localLinearLayout1.setPadding(5, 5, 5, 15);
    localLinearLayout1.addView(q.b(com.paypal.android.a.r.a, paramContext));
    this.f = new com.paypal.android.MEP.b.e(paramContext, this);
    this.f.a(this);
    localLinearLayout1.addView(this.f);
    addView(localLinearLayout1);
    this.d = com.paypal.android.a.f.a(paramContext, -1, -1);
    this.d.setOrientation(1);
    this.d.setPadding(10, 5, 10, 5);
    this.d.setBackgroundDrawable(com.paypal.android.a.f.a());
    com.paypal.android.b.j localj = new com.paypal.android.b.j(com.paypal.android.a.j.a("ANDROID_payment_made"), paramContext);
    this.d.addView(localj);
    this.p = com.paypal.android.a.f.a(paramContext, -1, -2);
    this.p.setOrientation(1);
    this.p.setPadding(5, 10, 5, 10);
    this.o = new com.paypal.android.b.k(paramContext, com.paypal.android.b.m.b);
    this.o.a("This page is currently being used to test components.");
    this.o.setPadding(0, 5, 0, 5);
    this.p.setVisibility(8);
    this.p.addView(this.o);
    this.d.addView(this.p);
    LinearLayout localLinearLayout2 = com.paypal.android.a.f.a(paramContext, -1, -2);
    localLinearLayout2.setOrientation(1);
    localLinearLayout2.setPadding(5, 0, 5, 5);
    TextView localTextView = q.a(com.paypal.android.a.r.a, paramContext);
    localTextView.setTextColor(-14993820);
    localTextView.setText(com.paypal.android.a.j.a("ANDROID_create_a_pin"));
    localTextView.setGravity(3);
    localLinearLayout2.addView(localTextView);
    this.d.addView(localLinearLayout2);
    LinearLayout localLinearLayout3 = com.paypal.android.a.f.a(paramContext, -1, -2);
    localLinearLayout3.setOrientation(1);
    localLinearLayout3.setPadding(10, 10, 10, 5);
    localLinearLayout3.setBackgroundDrawable(com.paypal.android.a.f.a());
    this.g = new EditText(paramContext);
    this.g.setLayoutParams(new RelativeLayout.LayoutParams(-1, -2));
    this.g.setInputType(3);
    this.g.setHint(com.paypal.android.a.j.a("ANDROID_enter_mobile"));
    this.g.setSingleLine(true);
    this.g.addTextChangedListener(this);
    localLinearLayout3.addView(this.g);
    this.h = new EditText(paramContext);
    this.h.setLayoutParams(new RelativeLayout.LayoutParams(-1, -2));
    this.h.setInputType(3);
    this.h.setHint(com.paypal.android.a.j.a("ANDROID_enter_pin"));
    this.h.setSingleLine(true);
    this.h.setTransformationMethod(PasswordTransformationMethod.getInstance());
    this.h.addTextChangedListener(this);
    localLinearLayout3.addView(this.h);
    this.i = new EditText(paramContext);
    this.i.setLayoutParams(new RelativeLayout.LayoutParams(-1, -2));
    this.i.setInputType(3);
    this.i.setHint(com.paypal.android.a.j.a("ANDROID_reenter_pin"));
    this.i.setSingleLine(true);
    this.i.setTransformationMethod(PasswordTransformationMethod.getInstance());
    this.i.addTextChangedListener(this);
    localLinearLayout3.addView(this.i);
    this.d.addView(localLinearLayout3);
    LinearLayout localLinearLayout4 = com.paypal.android.a.f.a(paramContext, -1, -2);
    localLinearLayout4.setGravity(1);
    localLinearLayout4.setOrientation(1);
    localLinearLayout4.setPadding(5, 10, 5, 5);
    this.j = new Button(paramContext);
    this.j.setLayoutParams(new RelativeLayout.LayoutParams(-1, com.paypal.android.a.f.b()));
    this.j.setText(com.paypal.android.a.j.a("ANDROID_create_pin"));
    this.j.setTextColor(-16777216);
    this.j.setBackgroundDrawable(g.a());
    this.j.setOnClickListener(this);
    this.j.setEnabled(false);
    localLinearLayout4.addView(this.j);
    this.d.addView(localLinearLayout4);
    LinearLayout localLinearLayout5 = com.paypal.android.a.f.a(paramContext, -1, -2);
    localLinearLayout5.setGravity(1);
    localLinearLayout5.setOrientation(1);
    localLinearLayout5.setPadding(5, 5, 5, 10);
    this.k = new Button(paramContext);
    this.k.setLayoutParams(new RelativeLayout.LayoutParams(-1, com.paypal.android.a.f.b()));
    this.k.setText(com.paypal.android.a.j.a("ANDROID_skip"));
    this.k.setTextColor(-16777216);
    this.k.setBackgroundDrawable(g.b());
    this.k.setOnClickListener(this);
    localLinearLayout5.addView(this.k);
    this.d.addView(localLinearLayout5);
    addView(this.d);
    this.e = new RelativeLayout(paramContext);
    this.e.setLayoutParams(new RelativeLayout.LayoutParams(-1, -1));
    this.e.setBackgroundDrawable(com.paypal.android.a.f.a());
    a(com.paypal.android.a.j.a("ANDROID_creating_pin"), false);
    this.e.setVisibility(8);
    addView(this.e);
    this.n = new Hashtable();
    if (!com.paypal.android.MEP.e.a().G())
      this.f.a(false, false);
  }

  public final void a(com.paypal.android.b.h paramh, int paramInt)
  {
  }

  public final void a(String paramString)
  {
    l.b();
    this.c = paramString;
    this.b = m.b;
    this.h.setText("");
    this.i.setText("");
    h.b();
  }

  public final void a(String paramString, Object paramObject)
  {
    this.n.put(paramString, paramObject);
  }

  public final void afterTextChanged(Editable paramEditable)
  {
    if ((c()) && (f()))
    {
      this.j.setEnabled(true);
      return;
    }
    this.j.setEnabled(false);
  }

  public final void beforeTextChanged(CharSequence paramCharSequence, int paramInt1, int paramInt2, int paramInt3)
  {
  }

  public final void d()
  {
    if (this.b == m.b)
    {
      this.d.setVisibility(0);
      this.e.setVisibility(8);
      this.o.a(this.c);
      this.p.setVisibility(0);
    }
    while (this.b != m.c)
      return;
    l.b();
    a(com.paypal.android.a.j.a("ANDROID_returning_to_merchant"), true);
    l.a();
    new Thread(new l(this)).start();
  }

  public final void e()
  {
  }

  public final void onClick(View paramView)
  {
    if (paramView == this.j)
      if ((c()) && (f()))
      {
        g();
        if (com.paypal.android.MEP.e.a().k() != 2)
        {
          str = this.g.getText().toString();
          p.a().b(this, str, this.h.getText().toString());
        }
        this.d.setVisibility(8);
        this.e.setVisibility(0);
        l.a();
        if (com.paypal.android.MEP.e.a().k() == 2)
        {
          this.b = m.c;
          h.b();
        }
      }
    while (paramView != this.k)
    {
      String str;
      return;
    }
    g();
    if ((a == null) || (a.length() == 0))
      a = "11111111";
    PayPalActivity.a().a((String)c.f().d("PayKey"), (String)c.f().d("PaymentExecStatus"));
  }

  public final void onTextChanged(CharSequence paramCharSequence, int paramInt1, int paramInt2, int paramInt3)
  {
  }
}

/* Location:           D:\Studium\Bachelorarbeit\BA Marcus Wobig\BA\BA\Decompiler\PicturePassword APK\Programm\PicturePassword_dex2jar.jar
 * Qualified Name:     com.paypal.android.MEP.a.k
 * JD-Core Version:    0.6.2
 */